var xh;
var doctor;
var Message;
function checkdoctor()
{     
    if (window.XMLHttpRequest){                      
        xh= new XMLHttpRequest();
    } 
    else   
    {
        xh=new ActiveXObject("Microsoft.XMLHTTP");
    }
    alert('check');
    doctor =document.getElementById("doctorid").value;   
    xh.open("get" , "./hospajax?user="+doctor , true);   
    xh.send(null); 
    xh.onreadystatechange=function()  
    {
       
         if(xh.readyState==4)
        {             
    
            Message=xh.responseText;            
        
        }
        demo();
    }  
    
  
}
function demo()
{
    if(Message)
        {   
         alert(document.getElementById('docotrid').value);
             
         
         id2.innerHTML="sucess";                
        }
        else
        {                
            document.getElementById('docotrid').value="";
            document.getElementById('id1').value.innerHTML="already exists";               
        }
}
